<?php $__env->startSection('title'); ?><?php echo Lang::get('users.edit_profile'); ?> - <?php $__env->stopSection(); ?>

<?php $__env->startSection('css_style'); ?>
<?php echo HTML::style('public/css/bootstrap-tokenfield.css'); ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?> 
     
     <?php 
     
     // ** Admin Settings ** //
     $settings = AdminSettings::first();
	 
	 // ** Data User logged ** //
     $user = Auth::user();

     ?>
     
<div class="col-md-8">
     	
     	 <!--********* panel panel-default ***************-->
     	<div class="panel panel-default">
		  <div class="panel-heading grid-panel-title">
		  	
		  	<span class="btn-block">
		  		<?php echo Lang::get('users.edit_profile'); ?>

		  	</span><!-- **btn-block ** -->
		  
		  </div><!-- ** panel-heading ** -->
		  
		  <div class="panel-body">
				  
			<form class="form-horizontal form-account" method="post" role="form" action="<?php echo URL::to('account'); ?>">
			 
			 <?php if(Session::has('notification')): ?>
			<div class="alert alert-success btn-sm" role="alert">
				<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            		<?php echo Session::get('notification'); ?> <i class="fa fa-long-arrow-right"></i> <a href="<?php echo URL::to('@'); ?><?php echo $user->username; ?>"><?php echo Lang::get('users.go_to_profile'); ?></a>
            		</div>
            	<?php endif; ?>
            	
			 <div class="form-group <?php if( $errors->first('full_name') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.full_name_misc'); ?></label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo e( $user->name ); ?>" name="full_name" class="form-control input-sm" id="full_name" placeholder="<?php echo Lang::get('misc.full_name_misc'); ?>">
			
			<?php if( $errors->first("full_name") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("full_name"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
	     	
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.username_misc'); ?> 
			    		<i class="icon-question" title="<?php echo Lang::get('misc.username_no_edit'); ?>"></i>
			    	</label>
			    <div class="col-sm-10">
			      <input id="disabledInput" disabled="disabled" type="text" value="<?php echo $user->username; ?>" class="form-control input-sm" placeholder="<?php echo Lang::get('misc.username_misc'); ?>">
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group <?php if( $errors->first('email') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('auth.email'); ?></label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo $user->email; ?>" name="email" class="form-control input-sm" id="email" placeholder="<?php echo Lang::get('auth.email'); ?>">
			    
			    <?php if( $errors->first("email") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("email"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group <?php if( $errors->first('location') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.location'); ?></label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo e( $user->location ); ?>" class="form-control input-sm" name="location" id="location" placeholder="<?php echo Lang::get('misc.placeholder_location'); ?>"autocomplete="off" >
			    
			     <?php if( $errors->first("location") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("location"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  
			  <div class="form-group <?php if( $errors->first('website') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.website_misc'); ?></label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo e( $user->website ); ?>" class="form-control input-sm" id="website" name="website" placeholder="<?php echo Lang::get('misc.website_misc'); ?>">
			    
			    <?php if( $errors->first("website") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("website"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group <?php if( $errors->first('twitter') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm">Twitter</label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo $user->twitter; ?>" class="form-control input-sm" id="inputTwitter" name="twitter" placeholder="<?php echo Lang::get('misc.username_on_Twitter'); ?>">
			    
			    <?php if( $errors->first("twitter") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("twitter"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group <?php if( $errors->first('skills') ): ?> has-error <?php endif; ?>">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.skills'); ?></label>
			    <div class="col-sm-10">
			      <input type="text" value="<?php echo $user->skills; ?>" name="skills" class="form-control input-sm" id="skills" placeholder="<?php echo Lang::get('misc.skills'); ?>">
			    
			    <?php if( $errors->first("skills") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("skills"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  
			  <div class="form-group <?php if( $errors->first('bio') ): ?> has-error <?php endif; ?>">
			    <label class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.bio_misc'); ?></label>
			    <div class="col-sm-10">
			      <textarea name="bio" rows="4" id="bio" class="form-control input-sm textarea-textx"><?php echo e( $user->bio ); ?></textarea>
			    
			    <?php if( $errors->first("bio") ): ?>    	
			<div class="alert alert-danger btn-sm errors-account" role="alert">
	            	<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	            		<strong><?php echo $errors->first("bio"); ?></strong>
	     	</div><!-- Error -->
	     	<?php endif; ?>
			    
			    </div>
			  </div><!-- **** form-group **** -->
			  			  
			  <h4 class="titleBar title-h4">
			  	<?php echo Lang::get('users.settings'); ?> / <?php echo Lang::get('misc.email_notifications'); ?>

			  	</h4>
			  
			  <hr />
			  
			  <?php if( Auth::user()->type_account == 2 || Auth::user()->type_account == 3 ): ?>
			  <!-- **** form-group **** -->
			  <div class="form-group">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.available_for_hire'); ?>?</label>
			    <div class="col-sm-10">
					<label class="checkbox-inline">
					 <input id="check_0" <?php if( $user->hire == 1 ) : echo 'checked="checked"'; endif ?> class="no-show"type="checkbox" value="1" name="hire" />
					   <span class="input-sm"><?php echo Lang::get('misc.available_true'); ?> </span>
					</label>
			    </div>
			  </div><!-- **** form-group **** -->
			  <?php endif; ?>
			  
			  			  
			  <!-- **** form-group **** -->
			  <div class="form-group">
			    <label for="inputEmail3" class="col-sm-2 control-label input-sm"><?php echo Lang::get('misc.email_notifications'); ?></label>
			    <div class="col-sm-10">
			    	<label class="checkbox-inline">
					 <input id="check_0" <?php if( $user->email_notification_msg == 1 ) : echo 'checked="checked"'; endif ?> class="no-show" type="checkbox" value="1" name="email_notification_msg" />
					   <span class="input-sm"><?php echo Lang::get('misc.messages_private'); ?></span>
					</label>
					<label class="checkbox-inline">
					  <input type="checkbox" <?php if( $user->email_notification_follow == 1 ) : echo 'checked="checked"'; endif ?> class="no-show" id="check_1" value="1" name="email_notification_follow" /> 
					  <span class="input-sm"><?php echo Lang::get('misc.being_followed'); ?></span>
					</label>
				
			    </div>
			  </div><!-- **** form-group **** -->

			  <hr />
			  
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button type="submit" class="btn btn-info btn-sm btn-sort" id="saveUpdate" disabled="disabled"><?php echo Lang::get('misc.save_changes'); ?></button>
			 <?php if( Auth::user()->id != 1 ): ?>  
			    <a href="javascript:void(0);" class="delete-account pull-right">
			    	<small><?php echo Lang::get('users.delete_account'); ?></small>
			    </a>
			    <?php endif; ?>
			    </div>
			  </div><!-- **** form-group **** -->
			  
			</form><!-- **** form **** -->
				  
		</div><!-- Panel Body -->

   </div><!-- Panel Default -->

			
 </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('sidebar'); ?>
<div class="col-md-4">
	
	<?php echo $__env->make('includes.user-card', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	
	<?php echo $__env->make('includes.sidebar_edit_user', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	
	<?php echo $__env->make('includes.ads', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
          
</div><!-- /End col md-4 -->

<?php $__env->stopSection(); ?>

<?php $__env->startSection('javascript'); ?>

  <?php echo HTML::script("https://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"); ?>

  <?php echo HTML::script('public/js/jquery.geocomplete.js'); ?>

  <?php echo HTML::script('public/js/bootstrap-tokenfield.js'); ?>

  
<script type="text/javascript">

$('#skills').on('tokenfield:createdtoken', function (e) {
	    var re = /^[a-z0-9][\w\s]+$/i
	    var valid = re.test(e.attrs.value)
	    if (!valid) {
	      $(e.relatedTarget).addClass('invalid').remove()
	    }
	  }).tokenfield({
		limit: 10,
		beautify: false
	});

//** Changes Form **//
function changesForm () {
var button = $('#saveUpdate');
$('form.form-account input, select, textarea, checked').each(function () {
    $(this).data('val', $(this).val());
    $(this).data('checked', $(this).is(':checked'));
});

$('form.form-account input, select, textarea, checked').bind('keyup change blur', function(){
    var changed  = false;
    var ifChange = false;
    button.css({'opacity':'0.7','cursor':'default'});
    
    $('form.form-account input, select, textarea, checked').each(function () {
        if( trim( $(this).val() ) != $(this).data('val') || $(this).is(':checked') != $(this).data('checked') ){
            changed = true;
            ifChange = true;
            button.css({'opacity':'1','cursor':'pointer'})
        }
       
    });
    button.prop('disabled', !changed);
});
}//<<<--- Function
changesForm();

	
	$("#bio").charCount({ allowed: <?php echo $settings->message_length; ?>, warning: 10, css: 'counterBio' });
	
	$(function(){
        $("#location").geocomplete()
        .bind("geocode:result", function(event, result){
          });
        });
        
  
  //<<<---------- Delete Account      
  $(".delete-account").click(function() {
   	
   	bootbox.confirm("<?php echo Lang::get('misc.delete_account_confirm'); ?>", function(r) {
 
   		if( r == true ) {
   			
   			var location = "<?php echo URL::to('delete/account'); ?>";
   			window.location.href = location;
	
	 }//END IF R TRUE 
	 
	  }); //Jconfirm  
   	
   });



</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>